package com.hyc.commons.base;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.hyc.commons.result.Result;

/** 
 * @author  作者 Mark: 
 * @date 创建时间：2018年1月14日 下午10:31:23 
 * @version 1.0 
 * @parameter  
 * @since  
 * @return 
 */
public abstract class BaseController {
   
	protected Logger logger=LogManager.getLogger(getClass());
	
	/**
	 * ajax失败
	 * @param msg 失败的信息
	 * @return {Object}
	 */
	public Object renderError(String msg){
		
		Result result=new Result();
		result.setMsg(msg);		
		return result;		
	}
	
	/**
	 * ajax成功
	 * @return {Object}
	 */
	public Object renderSuccess(){
		 
		Result result=new Result();
		result.setSuccess(true);
		return result;		
	}
	
	/**
	 * ajax成功
	 * @param data
	 * @return {Object}
	 */
	public Object renderSuccess(Object data){
		Result result=new Result();
		result.setSuccess(true);
		result.setData(data);
		return result;
	}
	
	/**
	 * ajax成功
	 * @param msg
	 * @return {Object}
	 */
	public Object renderSuccess(String msg){
		Result result=new Result();
		result.setSuccess(true);
		result.setMsg(msg);
		return result;
	}
	
	
	
	
}
